package route

import (
	"github.com/gin-gonic/gin"
	"jsjb/app/jsjb/controller"
	"jsjb/app/jsjb/middleware"
	"jsjb/setting"
)

func SetupRoute() *gin.Engine {
	if setting.Conf.Release {
		gin.SetMode(gin.ReleaseMode)
	}
	r := gin.Default()
	/*	// 告诉gin框架模板文件引用的静态文件去哪里找
		r.Static("/static", "static")
		// 告诉gin框架去哪里找模板文件
		r.LoadHTMLGlob("templates/*")
		r.GET("/", controller.IndexHandler)*/
	//jsjb
	jsjbGroup := r.Group("jsjb")
	{

		jsjbGroup.POST("test", controller.Demo)
		//人员登录组
		login := jsjbGroup.Group("login")
		//密码登录
		login.POST("password", controller.Login)
		//手机号登录
		login.POST("getUserPhoneNumber", controller.GetUserPhoneNumber)
		order := jsjbGroup.Group("order")
		order.Use(middleware.ParseAuth())
		{

			order.POST("queryAllHandleLists", controller.QueryAllHandleLists)
		}
		admin := jsjbGroup.Group("admin")
		//admin.Use(middleware.ParseAuth())
		//{

		admin.POST("set", controller.SetAdmin)
		admin.POST("update", controller.UpdateAdmin)
		admin.POST("delete", controller.DeleteAdmin)
		admin.POST("query", controller.QueryAdmin)
		//}
		rule := jsjbGroup.Group("rule")
		rule.POST("query", controller.QueryMenu)
		//列表

	}
	return r
}
